/**
 * Tencent is pleased to support the open source community by making Tseer available.
 *
 * Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
 * 
 * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * https://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software distributed 
 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */

// **********************************************************************
// This file was generated by a TARS parser!
// TARS version 1.0.1.
// **********************************************************************

package com.qq.tars.tseer;

import com.qq.tars.protocol.util.*;
import com.qq.tars.protocol.annotation.*;
import com.qq.tars.protocol.tars.*;
import com.qq.tars.protocol.tars.annotation.*;

/**
 * 上传发布包到服务器的结构参数
 */
@TarsStruct
public class PushPackageInfo {

	@TarsStructProperty(order = 0, isRequire = true)
	public String packageName = "";
	@TarsStructProperty(order = 1, isRequire = true)
	public long size = 0L;
	@TarsStructProperty(order = 2, isRequire = true)
	public String md5 = "";
	@TarsStructProperty(order = 3, isRequire = true)
	public byte[] vb = null;
	@TarsStructProperty(order = 4, isRequire = true)
	public long pos = 0;
	@TarsStructProperty(order = 5, isRequire = false)
	public String version = "";
	@TarsStructProperty(order = 6, isRequire = false)
	public String ostype = "CentOs-6.5-64";
	@TarsStructProperty(order = 7, isRequire = false)
	public int package_type = 0;
	@TarsStructProperty(order = 9, isRequire = false)
	public String user = "";

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public String getMd5() {
		return md5;
	}

	public void setMd5(String md5) {
		this.md5 = md5;
	}

	public byte[] getVb() {
		return vb;
	}

	public void setVb(byte[] vb) {
		this.vb = vb;
	}

	public long getPos() {
		return pos;
	}

	public void setPos(long pos) {
		this.pos = pos;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getOstype() {
		return ostype;
	}

	public void setOstype(String ostype) {
		this.ostype = ostype;
	}

	public int getPackage_type() {
		return package_type;
	}

	public void setPackage_type(int package_type) {
		this.package_type = package_type;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public PushPackageInfo() {
	}

	public PushPackageInfo(String packageName, long size, String md5, byte[] vb, long pos, String version, String ostype, int package_type, String user) {
		this.packageName = packageName;
		this.size = size;
		this.md5 = md5;
		this.vb = vb;
		this.pos = pos;
		this.version = version;
		this.ostype = ostype;
		this.package_type = package_type;
		this.user = user;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + TarsUtil.hashCode(packageName);
		result = prime * result + TarsUtil.hashCode(size);
		result = prime * result + TarsUtil.hashCode(md5);
		result = prime * result + TarsUtil.hashCode(vb);
		result = prime * result + TarsUtil.hashCode(pos);
		result = prime * result + TarsUtil.hashCode(version);
		result = prime * result + TarsUtil.hashCode(ostype);
		result = prime * result + TarsUtil.hashCode(package_type);
		result = prime * result + TarsUtil.hashCode(user);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof PushPackageInfo)) {
			return false;
		}
		PushPackageInfo other = (PushPackageInfo) obj;
		return (
			TarsUtil.equals(packageName, other.packageName) &&
			TarsUtil.equals(size, other.size) &&
			TarsUtil.equals(md5, other.md5) &&
			TarsUtil.equals(vb, other.vb) &&
			TarsUtil.equals(pos, other.pos) &&
			TarsUtil.equals(version, other.version) &&
			TarsUtil.equals(ostype, other.ostype) &&
			TarsUtil.equals(package_type, other.package_type) &&
			TarsUtil.equals(user, other.user) 
		);
	}

	public void writeTo(TarsOutputStream _os) {
		if (null != packageName) {
			_os.write(packageName, 0);
		}
		_os.write(size, 1);
		if (null != md5) {
			_os.write(md5, 2);
		}
		if (null != vb) {
			_os.write(vb, 3);
		}
		_os.write(pos, 4);
		if (null != version) {
			_os.write(version, 5);
		}
		if (null != ostype) {
			_os.write(ostype, 6);
		}
		_os.write(package_type, 7);
		if (null != user) {
			_os.write(user, 9);
		}
	}

	public void readFrom(TarsInputStream _is) {
		this.packageName = _is.read(packageName, 0, true);
		this.size = _is.read(size, 1, true);
		this.md5 = _is.read(md5, 2, true);
		this.vb = (byte[]) _is.read(vb, 3, true);
		this.pos = _is.read(pos, 4, true);
		this.version = _is.read(version, 5, false);
		this.ostype = _is.read(ostype, 6, false);
		this.package_type = _is.read(package_type, 7, false);
		this.user = _is.read(user, 9, false);
	}

}
